<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>智能排课系统</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.min.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='vendor/bootstrap-icons/bootstrap-icons.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
    {% if is_admin %}
    <link rel="stylesheet" href="{{ url_for('static', filename='css/user_mgmt.css') }}">
    {% endif %}
    <link rel="stylesheet" href="{{ url_for('static', filename='css/course_mgmt.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/school_mgmt.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/grade_mgmt.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/change_pwd.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/schedule_mgmt.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/schedule_view.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/schedule_detail.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/schedule_modify.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/schedule_search.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/schedule_free.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/schedule_stats.css') }}?v=2">
</head>
<body>
<!-- 导航 -->
<nav class="navbar navbar-light bg-white shadow-sm px-3">
    <div class="d-flex align-items-center w-100">

        <div class="navbar-title flex-grow-1 text-center">
            <i class="bi bi-calendar-event-fill"></i>智能排课
        </div>
        <div class="nav-icons d-flex align-items-center">
            <button class="icon-btn" title="添加" data-bs-toggle="modal" data-bs-target="#scheduleModal">
                <i class="bi bi-plus-lg"></i>
            </button>
            <div class="dropdown">
                <button class="icon-btn" id="searchDropdown" data-bs-toggle="dropdown" aria-expanded="false"
                        title="搜索">
                    <i class="bi bi-search" aria-hidden="true"></i>
                </button>
                <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="searchDropdown">
                    <li><a class="dropdown-item" href="#" id="open-search-modal"><i class="bi bi-search me-1"></i>查询排课</a></li>
                    <li><a class="dropdown-item" href="#" id="open-free-modal"><i class="bi bi-clock-history me-1"></i>空闲课时</a></li>
                </ul>
            </div>
            <button class="icon-btn" href="#" id="open-stats-modal" title="统计">
                <i class="bi bi-bar-chart-line" aria-hidden="true"></i>
            </button>
            <div class="dropdown">
                <button class="icon-btn" data-bs-toggle="dropdown"><i class="bi bi-gear-fill"></i></button>
                <ul class="dropdown-menu dropdown-menu-end">
                    <li><a class="dropdown-item" href="#" data-bs-toggle="modal"
                           data-bs-target="#courseMgmtModal">课程维护</a></li>
                    <li><a class="dropdown-item" href="#" data-bs-toggle="modal"
                           data-bs-target="#schoolMgmtModal">学校维护</a></li>
                    <li><a class="dropdown-item" href="#" data-bs-toggle="modal"
                           data-bs-target="#gradeMgmtModal">年级维护</a></li>
                    {% if is_admin %}
                    <li>
                        <a class="dropdown-item" href="#"
                           data-bs-toggle="modal"
                           data-bs-target="#userMgmtModal">
                            用户管理
                        </a>
                    </li>
                    {% endif %}
                </ul>
            </div>
            <div class="dropdown ms-1">
                <button class="icon-btn" data-bs-toggle="dropdown"><i class="bi bi-person-circle"></i></button>
                <ul class="dropdown-menu dropdown-menu-end">
                    <li class="dropdown-header">{{ current_user }}</li>
                    <li>
                        <a class="dropdown-item" href="#"
                           data-bs-toggle="modal"
                           data-bs-target="#changePwdModal">
                            修改密码
                        </a>
                    </li>
                    <li><a class="dropdown-item" href="{{ url_for('auth.logout') }}">退出</a></li>
                </ul>
            </div>
        </div>
    </div>
</nav>

<div class="schedule-area-full">
    <!-- 日期栏 -->
    <nav class="navbar navbar-expand-lg bg-light">
        <!-- 其它 nav 内容 -->
        <div id="date-bar">
            <button id="prev-day" class="nav-btn">
                <i class="bi bi-chevron-left"></i>
            </button>

            <div class="date-display-container">
                <span id="display-date"></span>
                <input type="date" id="view-date"/>
            </div>

            <button id="next-day" class="nav-btn">
                <i class="bi bi-chevron-right"></i>
            </button>
        </div>
    </nav>

    <!-- 卡片列表 -->
    <div id="cards-container" class="mt-4 container">
        <!-- JS 渲染的排课卡片放这里 -->
    </div>
</div>
{% if is_admin %}
{% include 'user_mgmt_modal.html' %}
{% endif %}
{% include 'course_mgmt_modal.html' %}
{% include 'school_mgmt_modal.html' %}
{% include 'grade_mgmt_modal.html' %}
{% include 'change_password_modal.html' %}
{% include 'schedule_modal.html' %}
{% include 'schedule_detail_modal.html' %}
{% include 'schedule_modify_once_modal.html' %}
{% include 'schedule_modify_ongoing_modal.html' %}
{% include 'schedule_search_modal.html' %}
{% include 'schedule_free_modal.html' %}
{% include 'schedule_stats_modal.html' %}
<script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
{% if is_admin %}
<script src="{{ url_for('static', filename='js/user_mgmt.js') }}"></script>
{% endif %}
<script src="{{ url_for('static', filename='js/course_mgmt.js') }}"></script>
<script src="{{ url_for('static', filename='js/school_mgmt.js') }}"></script>
<script src="{{ url_for('static', filename='js/grade_mgmt.js') }}"></script>
<script src="{{ url_for('static', filename='js/change_pwd.js') }}"></script>
<script src="{{ url_for('static', filename='js/schedule_mgmt.js') }}"></script>
<script src="{{ url_for('static', filename='js/schedule_view.js') }}"></script>
<script src="{{ url_for('static', filename='js/schedule_detail.js') }}"></script>
<script src="{{ url_for('static', filename='js/schedule_modify.js') }}"></script>
<script src="{{ url_for('static', filename='js/schedule_search.js') }}"></script>
<script src="{{ url_for('static', filename='js/schedule_free.js') }}"></script>
<script src="{{ url_for('static', filename='js/schedule_stats.js') }}"></script>
</body>
</html>
